﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;

namespace GestorDeFlotasDesktop.Classes
{
    public class Choferes
    {
        public List<Chofer> getChoferesHabilitados()
        { 
            
            List<Chofer> lista = new List<Chofer>();
            SqlDataReader rdrLector;
            rdrLector = SqlInterface.ExecuteReader("SQUIRTLE.spGetChoferesHabilitados");
            if (rdrLector.HasRows)
            {
                while (rdrLector.Read())
                {
                    Chofer oChofer = new Chofer();
                    oChofer.intDNI = rdrLector.GetInt32(rdrLector.GetOrdinal("CHOFER_DNI"));
                    oChofer.strNombreCompleto = rdrLector.GetString(rdrLector.GetOrdinal("CHOFER_NOMBRE")) + " " +
                                                rdrLector.GetString(rdrLector.GetOrdinal("CHOFER_APELLIDO")) + "(" +
                                                Convert.ToString(oChofer.intDNI) + ")";
                    lista.Add(oChofer);
                }
            }
            return lista;
        }
    }
}
